<?php

namespace app\model\system;

use basic\BaseModel;
use traits\ModelTrait;
use think\db\BaseQuery;

class SystemAdmin extends BaseModel
{
    use ModelTrait;

    protected $name = "system_admin";

    /**
     * 设置用户登录名搜索器
     *
     * @param BaseQuery    $query
     * @param string|array $value
     * @param              $data
     */
    public function searchUsernameAttr($query, $value, $data)
    {
        valid_arg('username', $data) && $query->where('username', '=', $value);
    }

    /**
     * 设置联系手机号搜索器
     *
     * @param BaseQuery    $query
     * @param string|array $value
     * @param              $data
     */
    public function searchPhoneAttr($query, $value, $data)
    {
        valid_arg('phone', $data) && $query->where('phone', 'like', '%' . $value . '%');
    }


}